﻿using SunnyPaine.Autofac.Extension.Mvvm.Test.ViewModel;
using SunnyPaine.Autofac.Extension.Mvvm.ViewCore;
using SunnyPaine.Autofac.Extension.Stereotype.Attributes;
using System.Windows;

namespace SunnyPaine.Autofac.Extension.Mvvm.Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, IWindow
    {
        //[Autowired] //根据类型注入
        [Resource(Name = "MainViewModel")] // 根据名称注入
        private IMainViewModel ViewModel
        {
            get { return (IMainViewModel)this.DataContext; }
            set { this.DataContext = value; }
        }

        //public MainWindow(IMainViewModel viewModel) //构造器注入
        public MainWindow()
        {
            this.InitializeComponent();
            //this.DataContext = viewModel;
        }
    }
}